//
//  RegisterViewModel.m
//  GTTool
//
//  Created by GTO on 2018/8/27.
//  Copyright © 2018年 GTO. All rights reserved.
//

#import "RegisterViewModel.h"

@implementation RegisterViewModel
- (instancetype)init
{
    if (self = [super init]) {
        [self initialBind];
    }
    return self;
}
// 初始化绑定
- (void)initialBind
{
    _RegiterCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id  _Nullable input) {
        
        return [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
            
            //网络请求登录
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                
                //拿到数据发送.
                [subscriber sendNext:@"登录成功"];
                // 数据传送完毕，必须调用完成，否则命令永远处于执行状态
                [subscriber sendCompleted];
            });
            
            return nil;
        }];
    }];
}
@end
